package ace.tool.generate.code.impl.resolver.util;

import org.apache.commons.text.WordUtils;

/**
 * @author caspar
 * @date 2024/7/22 14:52
 */
public class ProjectUtils {
  public static String getProjectModuleCodeName(String projectName) {
    boolean hasDash = projectName.contains("-");
    if (hasDash) {
      StringBuilder sb = new StringBuilder();
      String[] projectNames = projectName.split("-");
      for (int i = 0; i < projectNames.length; i++) {
        if (i == 0) {
          sb.append(WordUtils.uncapitalize(projectNames[i]));
        } else {
          sb.append(WordUtils.capitalize(projectNames[i]));
        }
      }
      return sb.toString();
    }

    return projectName;
  }
}
